// miniprogram/pages/inspectiontask/quetask/quetask.js
var utils = require('../../../utils/getTool');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    active:0,
    quetask:{
      inspectionTaskCode:"WX0001",
      inspectionTaskName:"巡检任务名称",
      lineName:"西危险",
      startPoleCode:"Wx00001",
      endPoleCode:"xw00256",
      issuedByName:"张三",
      issuedTime:"2012-06-03",
      taskStatusName:"未完成",
      finishTime:"",
      common:"无"
    },
    psInspectorDetailList: [{ solverName: "巡检员1" }, { solverName: "巡检员2" }]
  },
  iconClick(){
    
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var insList = getApp().appData.inspectionList[options.index];
    console.log(insList)
    utils.req({ // 查询巡检员
      url:getApp().appData.site+"/accp/psInspectorDetail/taskDetail",
      data:{
        staskId: insList.id
      },
      success:res=>{
        console.log(res)
        this.setData({
          taskDetail:res.data
        })
      }
    })
    this.setData({//拿传递来的值
      quetask: insList, //地址栏传递index 实际上拿appData的数据
      userInfo:wx.getStorageSync("userInfo")
    })
    utils.req({
      url: getApp().appData.site+"/accp/psInspectiontaskDetail/insCtionDetail",
      data:{
        taskId: insList.id
      },
      success: res => {
        var myFor2 = [];
        for(var i in res.data){
          myFor2.push(res.data[i])
          myFor2[i].creationTime = utils.dateConvert(res.data[i].creationTime);
          myFor2[i].discoverTime=utils.dateConvert(res.data[i].discoverTime);
          myFor2[i].lastUpdateTime=utils.dateConvert(res.data[i].lastUpdateTime);
          myFor2[i].inspectTime=utils.dateConvert(res.data[i].inspectTime);
        }
        console.log(myFor2)
        this.setData({
          taskDetailList: myFor2,
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})